<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.3">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">





  <meta name="keywords" content="Git,Hexo,网站," />










<meta name="description" content="为何使用Hexo最常用的静态网站模板引擎显然是Jekyll，它有着目前最大的模板生态，且被GitHub等提供Page服务的代码托管网站直接支持，只需要push Jekyll项目本身即可由Page服务自动转为静态网站发布。  对于GitHub而言：上传到项目的gh-pages分支即可直接解析为静态页面 对于码云而言：需要">
<meta name="keywords" content="Git,Hexo,网站">
<meta property="og:type" content="article">
<meta property="og:title" content="基于Hexo与GitHub的建站笔记">
<meta property="og:url" content="http://ivon.top/2017/11/26/基于Hexo与GitHub的建站笔记/index.html">
<meta property="og:site_name" content="Ivon&#39;s Notebook">
<meta property="og:description" content="为何使用Hexo最常用的静态网站模板引擎显然是Jekyll，它有着目前最大的模板生态，且被GitHub等提供Page服务的代码托管网站直接支持，只需要push Jekyll项目本身即可由Page服务自动转为静态网站发布。  对于GitHub而言：上传到项目的gh-pages分支即可直接解析为静态页面 对于码云而言：需要在项目主页的 服务=&amp;gt;Pages 中选择开启Page静态网站服务。可以指定">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-11-29T02:28:26.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="基于Hexo与GitHub的建站笔记">
<meta name="twitter:description" content="为何使用Hexo最常用的静态网站模板引擎显然是Jekyll，它有着目前最大的模板生态，且被GitHub等提供Page服务的代码托管网站直接支持，只需要push Jekyll项目本身即可由Page服务自动转为静态网站发布。  对于GitHub而言：上传到项目的gh-pages分支即可直接解析为静态页面 对于码云而言：需要在项目主页的 服务=&amp;gt;Pages 中选择开启Page静态网站服务。可以指定">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.3',
    sidebar: {"position":"left","display":"always","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":true,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: 'UVBQP5J09B',
      apiKey: 'c52c00bfaff064f97caf9a6c225af449',
      indexName: 'ivon',
      hits: {"per_page":10},
      labels: {"input_placeholder":"~请输入需要查询的内容~","hits_empty":"然而查询 ${query} 并没有找到结果~","hits_stats":"找到了 ${hits} 个结果，耗时 ${time} ms~"}
    }
  };
</script>



  <link rel="canonical" href="http://ivon.top/2017/11/26/基于Hexo与GitHub的建站笔记/"/>





  <title>基于Hexo与GitHub的建站笔记 | Ivon's Notebook</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Ivon's Notebook</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description"></h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://ivon.top/2017/11/26/基于Hexo与GitHub的建站笔记/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Ivon Ma">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Ivon's Notebook">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">基于Hexo与GitHub的建站笔记</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-11-26T21:19:55+08:00">
                2017-11-26
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/其他/" itemprop="url" rel="index">
                    <span itemprop="name">其他</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/11/26/基于Hexo与GitHub的建站笔记/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count gitment-comments-count" data-xid="/2017/11/26/基于Hexo与GitHub的建站笔记/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="为何使用Hexo"><a href="#为何使用Hexo" class="headerlink" title="为何使用Hexo"></a>为何使用Hexo</h1><p>最常用的静态网站模板引擎显然是Jekyll，它有着目前最大的模板生态，且被GitHub等提供Page服务的代码托管网站直接支持，只需要push Jekyll项目本身即可由Page服务自动转为静态网站发布。</p>
<ul>
<li>对于GitHub而言：上传到项目的<code>gh-pages</code>分支即可直接解析为静态页面</li>
<li>对于码云而言：需要在项目主页的 服务=&gt;Pages 中选择开启Page静态网站服务。可以指定分支。</li>
</ul>
<p>与Jekyll不同，Hexo在本地生成静态网站，而后发布到Git远程仓库上去的是已经生成好的静态网站，不需要Page服务来做转换。这样做的好处是，可以绕过GitHub Page为了安全性考虑而禁用jekyll插件的问题，在生成静态网站时获得更强的拓展性；且由于不需要提交项目本身到公共仓库，可以更好地保护可能存储在配置文件中的私有信息，如各种api Key。</p>
<p>虽然jekyll也可以在本地生成静态网站而后直接提交，但hexo对此的支持更好。例如它提供了基于Node.js的本地服务器用于本地预览生成的静态页面，再例如使用它的<code>hexo deploy</code>命令可以直接生成静态网站并提交到远程Git仓库。</p>
<h1 id="Hexo的使用"><a href="#Hexo的使用" class="headerlink" title="Hexo的使用"></a>Hexo的使用</h1><h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><ul>
<li><p>安装步骤：</p>
<ol>
<li><p>安装node.js： <code>brew install node</code></p>
</li>
<li><p>安装Git：<code>brew install git</code></p>
</li>
<li><p>安装hexo：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br><span class="line">npm install hexo --save</span><br></pre></td></tr></table></figure>
</li>
</ol>
</li>
</ul>
<h2 id="创建项目"><a href="#创建项目" class="headerlink" title="创建项目"></a>创建项目</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">mkdir hexoxx  #创建一个项目文件夹</span><br><span class="line">cd hexoxx</span><br><span class="line"><span class="meta">#</span> 部署Hexo</span><br><span class="line">hexo init</span><br></pre></td></tr></table></figure>
<h2 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h2><ul>
<li>清理本地已生成的网页文件：<code>hexo clean</code></li>
<li>生成网页文件：<code>hexo generate</code></li>
<li>本地运行测试服务器：<code>hexo s -d</code></li>
<li>发布到远程Git仓库：<code>hexo deploy</code><ul>
<li>需要先在站点配置文件中添加deploy信息。</li>
<li>错误提示：<code>ERROR Deployer not found: git</code>，解决方式：<code>npm install --save hexo-deployer-git</code>。注意，插件是为当前目录下hexo项目安装，而不是全局。</li>
</ul>
</li>
</ul>
<h1 id="Hexo-Next模板"><a href="#Hexo-Next模板" class="headerlink" title="Hexo-Next模板"></a>Hexo-Next模板</h1><h2 id="下载hexo的next模板"><a href="#下载hexo的next模板" class="headerlink" title="下载hexo的next模板"></a>下载hexo的next模板</h2><ol>
<li>cd到已经init的hexo项目目录下，将next模板clone到本地<code>git clone https://github.com/iissnan/hexo-theme-next themes/next</code></li>
<li>在站点配置文件中，修改theme的值为hexo</li>
</ol>
<p>参考：<a href="https://github.com/iissnan/hexo-theme-next" target="_blank" rel="noopener">Next Github主页</a> <a href="http://theme-next.iissnan.com/third-party-services.html" target="_blank" rel="noopener">Next中文文档</a></p>
<h2 id="集成第三方服务"><a href="#集成第三方服务" class="headerlink" title="集成第三方服务"></a>集成第三方服务</h2><h3 id="站内搜索：采用algolia"><a href="#站内搜索：采用algolia" class="headerlink" title="站内搜索：采用algolia"></a>站内搜索：采用algolia</h3><ol>
<li><p>到algolia注册</p>
</li>
<li><p>cd到项目目录下</p>
</li>
<li><p>安装hexo的algolia插件<code>npm install --save hexo-algolia</code></p>
<ul>
<li>注意还有个版本叫hexo-algoliasearch，与本插件配置并不是同一个，配置文件也不完全相同。例如hexo-algoliasearch中applicationID叫appID，且不需要设置HEXO_ALGOLIA_INDEXING_KEY。但hexo-algoliasearch似乎版本比较老，使用hexo-algolia会比较好。</li>
</ul>
</li>
<li><p>到站点配置文件中，按如下格式配置algolia提供的相关key信息</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">algolia:</span></span><br><span class="line"><span class="attr">  applicationID:</span> <span class="string">'xxx'</span></span><br><span class="line"><span class="attr">  apiKey:</span> <span class="string">'xxx'</span></span><br><span class="line"><span class="attr">  adminApiKey:</span> <span class="string">'xxx'</span></span><br><span class="line"><span class="attr">  indexName:</span> <span class="string">'xxx'</span></span><br><span class="line"><span class="attr">  chunkSize:</span> <span class="number">5000</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>到主题配置文件中，将algolia_search: enable设置为 true</p>
</li>
<li><p>使用<code>hexo algolia</code>命令即可向algolia添加索引</p>
<ul>
<li>如果出现ERROR [Algolia] Please set an `HEXO_ALGOLIA_INDEXING_KEY` environment variable to enable content indexing.错误：需要到algolia控制台中为api-Key开启对本index的Add record, List indices, Delete records, Delete index四项权限，并在项目目录下执行<code>export HEXO_ALGOLIA_INDEXING_KEY=xxxxxx</code>将api-Key设置为环境变量<ul>
<li>参见：<a href="http://jonge.club/2017/11/04/git-page-hexo-domain/" target="_blank" rel="noopener">http://jonge.club/2017/11/04/git-page-hexo-domain/</a></li>
</ul>
</li>
<li>该插件早期版本曾经使用项目目录下的路径path属性作为跳转地址，而后期改用了代表绝对路径的permalink属性。这就造成如果使用早期版本或Next的不兼容版本，会导致虽然可以搜索到结果，但跳转路径为undefind或缺失站点url部分。如果出现此类情况，建议完全重新clone最新版本的Next，并安装最新的hexo-algolia插件。</li>
<li>参见：<a href="https://github.com/oncletom/hexo-algolia" target="_blank" rel="noopener">hexo-algolia插件 GitHub主页</a></li>
</ul>
</li>
</ol>
<h3 id="评论系统：采用Gitment"><a href="#评论系统：采用Gitment" class="headerlink" title="评论系统：采用Gitment"></a>评论系统：采用Gitment</h3><h4 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h4><p>Gitment是一个基于GitHub仓库的Issue系统的评论系统。</p>
<h4 id="原理"><a href="#原理" class="headerlink" title="原理"></a>原理</h4><p>对每个页面的评论，实际上会被作为该仓库的一条Issue存在。只要页面绝对地址不变，那么即使曾经删除页面，恢复后依然可以对应上原有评论。</p>
<h4 id="缺点"><a href="#缺点" class="headerlink" title="缺点"></a>缺点</h4><p>只支持GitHub用户评论。</p>
<h4 id="步骤"><a href="#步骤" class="headerlink" title="步骤"></a>步骤</h4><ol>
<li><a href="https://github.com/settings/applications/new" target="_blank" rel="noopener">点击此处</a> 去GitHub来注册一个新的 OAuth Application</li>
<li>在主题配置文件中将gitment的enable设置为true，并根据上一步获取到的信息填写所有必填项即可。</li>
</ol>
<h4 id="注意"><a href="#注意" class="headerlink" title="注意"></a>注意</h4><ul>
<li>5.13+版本Next主题已经支持直接集成Gitment系统。只需要在配置文件中打开即可，不需要手动引入JS。</li>
</ul>
<p>参考：<a href="https://extremegtr.github.io/2017/09/07/Add-Gitment-comment-system-to-hexo-theme-NexT/" target="_blank" rel="noopener">添加Gitment评论系统到Hexo主题NexT</a> <a href="https://imsun.net/posts/gitment-introduction/" target="_blank" rel="noopener">Gitment：使用 GitHub Issues 搭建评论系统</a></p>
<h3 id="统计系统：采用不蒜子"><a href="#统计系统：采用不蒜子" class="headerlink" title="统计系统：采用不蒜子"></a>统计系统：采用不蒜子</h3><ul>
<li>Next主题已经集成了不蒜子统计，在主题配置文件中将<code>busuanzi_count</code>的enanble设置为true即可。其他可选配置项参见Next中文文档。</li>
</ul>
<h1 id="设置访问地址"><a href="#设置访问地址" class="headerlink" title="设置访问地址"></a>设置访问地址</h1><ul>
<li>对于GitHub而言<ul>
<li>项目主页的默认访问地址是 <code>https://用户名.github.io/项目名</code> </li>
<li>如果希望直接使用<code>https://用户名.github.io/</code>访问，只需将项目名设置为<code>用户名.github.io</code></li>
<li>地址中及项目名中的用户名都是小写</li>
</ul>
</li>
<li>对于码云而言<ul>
<li>项目主页的默认访问地址是 <code>http://用户名.gitee.io/项目名</code> </li>
<li>与GitHub不同，如果希望直接使用<code>https://用户名.gitee.io/</code>访问，需将项目名设置为<code>用户名</code></li>
<li>地址中及项目名中的用户名都是小写</li>
</ul>
</li>
</ul>
<h1 id="绑定域名"><a href="#绑定域名" class="headerlink" title="绑定域名"></a>绑定域名</h1><ul>
<li>对于GitHub而言<ul>
<li>项目主页=&gt;Settings=&gt;GitHub Page=&gt;Custom domain 设置为买来的域名</li>
<li>保证每次上传后远程仓库的根目录下都有CNAME文件，内容为自定义域名。<ul>
<li>对hexo而言，放到source目录下即可保证每次生成和上传后根目录下都有该文件。</li>
</ul>
</li>
</ul>
</li>
<li>对于码云而言<ul>
<li>不支持自定义域名</li>
</ul>
</li>
</ul>
<p><a href="http://git.mydoc.io/?t=154714" target="_blank" rel="noopener">码云Pages帮助文档</a></p>
<p><a href="https://help.github.com/categories/github-pages-basics/" target="_blank" rel="noopener">GitHub Pages帮助文档</a></p>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>Would you plz spare me a cup of coffee?</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechatpay.jpg" alt="Ivon Ma 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpg" alt="Ivon Ma 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Git/" rel="tag"># Git</a>
          
            <a href="/tags/Hexo/" rel="tag"># Hexo</a>
          
            <a href="/tags/网站/" rel="tag"># 网站</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/11/23/Hessian/" rel="next" title="Hessian">
                <i class="fa fa-chevron-left"></i> Hessian
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/11/27/Spring 自带的定时器：scheduling/" rel="prev" title="Spring 自带的定时器：scheduling">
                Spring 自带的定时器：scheduling <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      
        <div id="gitment-container"></div>
      
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="Ivon Ma" />
            
              <p class="site-author-name" itemprop="name">Ivon Ma</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">18</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">5</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">34</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          <div class="links-of-author motion-element">
            
              
                <span class="links-of-author-item">
                  <a href="https://github.com/IvonMa" target="_blank" title="GitHub">
                    
                      <i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.zhihu.com/people/ma-yun-feng/" target="_blank" title="Zhihu">
                    
                      <i class="fa fa-fw fa-heart-o"></i>Zhihu</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="mailto:ivonma@126.com" target="_blank" title="E-Mail">
                    
                      <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
            
          </div>

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#为何使用Hexo"><span class="nav-number">1.</span> <span class="nav-text">为何使用Hexo</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Hexo的使用"><span class="nav-number">2.</span> <span class="nav-text">Hexo的使用</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装"><span class="nav-number">2.1.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建项目"><span class="nav-number">2.2.</span> <span class="nav-text">创建项目</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#常用命令"><span class="nav-number">2.3.</span> <span class="nav-text">常用命令</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Hexo-Next模板"><span class="nav-number">3.</span> <span class="nav-text">Hexo-Next模板</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#下载hexo的next模板"><span class="nav-number">3.1.</span> <span class="nav-text">下载hexo的next模板</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#集成第三方服务"><span class="nav-number">3.2.</span> <span class="nav-text">集成第三方服务</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#站内搜索：采用algolia"><span class="nav-number">3.2.1.</span> <span class="nav-text">站内搜索：采用algolia</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#评论系统：采用Gitment"><span class="nav-number">3.2.2.</span> <span class="nav-text">评论系统：采用Gitment</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#简介"><span class="nav-number">3.2.2.1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#原理"><span class="nav-number">3.2.2.2.</span> <span class="nav-text">原理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#缺点"><span class="nav-number">3.2.2.3.</span> <span class="nav-text">缺点</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#步骤"><span class="nav-number">3.2.2.4.</span> <span class="nav-text">步骤</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#注意"><span class="nav-number">3.2.2.5.</span> <span class="nav-text">注意</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#统计系统：采用不蒜子"><span class="nav-number">3.2.3.</span> <span class="nav-text">统计系统：采用不蒜子</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#设置访问地址"><span class="nav-number">4.</span> <span class="nav-text">设置访问地址</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#绑定域名"><span class="nav-number">5.</span> <span class="nav-text">绑定域名</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2013 &mdash; <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Ivon Ma</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.3</div>




        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>



  


  




	





  





  







<!-- LOCAL: You can save these files to your site and update links -->
    
        
        <link rel="stylesheet" href="https://aimingoo.github.io/gitmint/style/default.css">
        <script src="https://aimingoo.github.io/gitmint/dist/gitmint.browser.js"></script>
    
<!-- END LOCAL -->

    
      <style>
        a.gitment-editor-footer-tip { display: none; }
        .gitment-container.gitment-footer-container { display: none; }
      </style>
    

    
      <script type="text/javascript">
      function renderGitment(){
        var gitment = new Gitmint({
            id: window.location.pathname, 
            owner: 'IvonMa',
            repo: 'ivonma.github.io',
            
            lang: "" || navigator.language || navigator.systemLanguage || navigator.userLanguage,
            
            oauth: {
            
            
                client_secret: 'd61c00dc8d0f99d82c36e47096dedf79a1f47cb6',
            
                client_id: 'ac63a706f554739bbcaa'
            }});
        gitment.render('gitment-container');
      }

      
      renderGitment();
      
      </script>
    







  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=5.1.3"></script>



  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  
  
  <link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css">

  
  
  <script src="/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
    
  </script>

  

  

  

  

</body>
</html>
